package com.credithc.customers.dataservice.init;

import com.credithc.customers.dataservice.service.InitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

/**
 * @author zhukai
 * @date 2019/1/15 16:45
 */
@Component
public class CacheListener implements ApplicationListener<ContextRefreshedEvent> {

    private final InitService initService;

    @Autowired
    public CacheListener(InitService initService) {
        this.initService = initService;
    }

    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) {
        initService.cacheDictMapper();
    }
}
